package com.hljx.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @BelongsProject: hljx
 * @BelongsPackage: com.hljx.config
 * @Author: lp
 * @CreateTime: 2023-12-20  16:18
 * @Description: TODO
 * @Version: 1.0
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[] swaggerExcludes = new String[]{
                "/login",
                "/swagger**/**",
                "/webjars/**",
                "/v3/**",
                "/doc.html"
        };

        registry.addInterceptor(new CustomInterceptor()).addPathPatterns("/**")
                .excludePathPatterns(swaggerExcludes); // 添加需要拦截的路径
    }
}
